# -*- coding: utf-8 -*-
'''
	应用入口
'''
import uvicorn
from fastapi import FastAPI
from backend.config import get_config
from backend.router import register_router
from backend.library.database import create_tables

config = get_config()

# 创建应用
app = FastAPI(
    title=config.title,
    description=config.description,
    debug=config.debug
)

# @app.on_event('startup')
# async def start_up():
#     print("---------------------初始化数据库---------------")
#     create_tables()


register_router(app)


if __name__ == '__main__':
    # 启动应用
    uvicorn.run(
        app     = 'main:app', 
        host    = config.host, 
        port    = config.port, 
        reload  = True
    )